<template>
  <view class="page-container">
    <u-list @scrolltolower="scrolltolower">
      <u-list-item v-for="(item, index) in lawAdviceList" :key="index">
        <u-cell :title="item.title" @click="toDetail(item)">
          <u-avatar
            slot="icon"
            shape="square"
            size="40"
            :src="item.icon"
            customStyle="margin: 5px"
          ></u-avatar>
        </u-cell>
      </u-list-item>
    </u-list>
  </view>
</template>
<script>
import consultAndServiceConst from "@/static/const/consultAndServiceConst";

export default {
  data() {
    return {
      lawAdviceList: [],
    };
  },
  onLoad(options) {
    this.getList();
  },
  methods: {
    //获取列表
    getList() {
      this.$store
        .dispatch("ConsultAndServiceList", consultAndServiceConst.consult)
        .then((res) => {
          console.log(res);
          this.lawAdviceList = res.data;
          //去除更多的数据
          this.lawAdviceList = this.lawAdviceList.filter(
            (item) => item.title != "更多"
          );
        });
    },
    toDetail(index) {
      uni.navigateTo({
        url: "/pages/telephone-consultation/index?id=" + index.id,
      });
    },
    scrolltolower() {
      console.log("scrolltolower");
    },
  },
};
</script>
<style scoped lang="scss">
.page-container {
  width: 100%;
  min-height: 100vh;
  background-color: #fff;
}
</style>
